package view.listeners;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JRadioButton;

import view.views.dialogContentViews.AddSimpleIPContentPanel;
import controller.Calculator;

public class RadioButtonListener implements ActionListener {

	private final JRadioButton button;
	private final AddSimpleIPContentPanel content;

	public RadioButtonListener(JRadioButton button,
			AddSimpleIPContentPanel addSimpleIPContentPanel) {
		this.button = button;
		content = addSimpleIPContentPanel;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if (button.isSelected()) {
			int i = content.getButtons().indexOf(button);
			Calculator.getInstance().modifyTextFields(i, content);
		}

	}

}
